package demo2;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class DBUtil {
    @Value("同志们好")
    private String url;
    @Value("为人民服务")
    private String username;
    @Value("与天斗，与地斗,与人斗,其乐无穷")
    private String password;



    public String getUrl() {
        return url;
    }
  //  @Value("jbdc:mysql://localhost:3306/")
  @Value("${spring.datasource.url}")
    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }
   // @Value("root")
   @Value("${spring.datasource.username}")
    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }
   // @Value("root")
   @Value("${spring.datasource.password}")
    public void setPassword(String password) {
        this.password = password;
    }



    @Override
    public String toString() {
        return "DBUtil{" +
                "url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
